<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .app{
            width: 700px;
            margin: 300px auto;
        }
    </style>
</head>
<script src="./js/vue.js"></script>
<body>
    <div class="app">
        <input type="number" v-model="input1">
        <select v-model="selected">
            <option value="0"> + </option>
            <option value="1"> - </option>
            <option value="2"> * </option>
            <option value="3"> / </option>
        </select>
        <input type="number" v-model="input2">
        <button v-on:click="onclick"> = </button>
        <input type="number" v-model="sum">
    </div>

    <script>
        const vm = new Vue({
            el:'.app',
            data:{
                selected:'',
                input1:'',
                input2:'',
                sum:''
            },
            methods:{
                onclick(){
                    if(this.selected == '0'){
                        this.sum = (this.input1 - 0) + (this.input2 - 0)
                    }else if(this.selected == '1'){
                        this.sum = eval(this.input1 - this.input2)
                    }else if(this.selected == '2'){
                        this.sum = eval(this.input1 * this.input2)
                    }else if(this.selected == '3'){
                        this.sum = eval(this.input1 / this.input2)
                    }
                }
            }
        })
    </script>
</body>
</html>